const arr = [1,2,3,4,5];

console.log(arr.concat([6,7],[8,9]));
console.log(arr.reverse());

const str = "hello";
console.log(str.split("").reverse().join(""));

//object
console.log("----------------");

const obj = {
    name:"zhangsan",
    age:18,
    printName:function(){
        console.log(this.name);
    },
    printAge:function(){
        console.log(this.age);
    }
};

console.log(Object.keys(obj));
const values = Object.values(obj);
console.log(values);
obj.printAge();
values[2].call(obj); //这里需要指定对象，避免this指向错误

//闭包在防误触中的独特优势..



console.log("----------------");
function Star(name,age) {
    this.name = name;
    this.age = age;
    this.printName = function(){
        console.log(this.name);
    }
}

const start1 = new Star("Tom",18);
start1.printName()

function add(a,b) {
    return a+b;
}

const addFunction = new add(1,2);
console.log(addFunction);
